package com.test.stock.service.impl;

import com.test.stock.service.StockService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author IT贱男
 * @version v1.0.0
 * @date 2022/11/7 16:36
 */
@Service
public class StockServiceImpl implements StockService {

    private static final Map<Integer, Integer> stockMap = new HashMap<>();

    static {
        stockMap.put(1001, 100);
        stockMap.put(1002, 99);
        stockMap.put(1003, 88);
        stockMap.put(1004, 77);
    }

    @Override
    public Integer selectStockByProductId(Integer productId) {
        return stockMap.get(productId);
    }
}
